<?php
namespace app\common\model;
use think\Model;
use think\Db;
use app\common\model\Homework;
/**
 * 学科类目
 */
class worker extends Model
{
    
    protected $append = [
        'homework',
        'admin'
    ];

    public function getAdminAttr($value,$data){
        if($data['admin_id'] == 0) return [];
        return Db::name('Admin')->where('id',$data['admin_id'])->find();
    }

    public function getExamAttr($value,$data){
       return Homework::get($data['homework_id']);
    }
}